// app.js
const mkdirp = require('mz-modules/mkdirp');
var FileStore = require("./utils/session-file-store");
module.exports = app => {
  // 新建上传文件的目录
  mkdirp.sync(app.config.uploadDest);
  app.beforeStart(async () => {
    //自动创建对应的model
    await app.model.User.sync({force: false});
    await app.model.Ad.sync({force: false});
    await app.model.Article.sync({force: false});
    await app.model.Attention.sync({force: false});
    await app.model.Comment.sync({force: false});
    await app.model.Like.sync({force: false});
    await app.model.Active.sync({force: false});
  });
  app.sessionStore = new FileStore();
};